package com.jf.identity.controller;

import com.jf.identity.entity.ExaminerVerifyInfo;
import com.jf.identity.entity.ResponseBean;
import com.jf.identity.service.ExaminerService;
import com.jf.identity.util.Params;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by x on 2018/4/11.
 */
@Controller
@RequestMapping("/cdm/")
public class ExaminerController {
    @Resource
    private ExaminerService examinerService;

    @RequestMapping(value = "get-examiner-rel-info")
    @ResponseBody
    public ResponseBean getExaminerRelInfo() {
        return new ResponseBean(examinerService.getExaminerRelInfo());
    }

    @RequestMapping(value = "set-examiner-sign-info")
    @ResponseBody
    public ResponseBean setExaminerRelInfo(@Validated @RequestBody ExaminerVerifyInfo examiners,
                                           BindingResult bindingResult) {
        Params.beanValidate(bindingResult);
        return new ResponseBean(examinerService.insertExaminerVerifyInfo(examiners));
    }
}
